package com.lizhi.yun.base.common;

import com.sun.org.apache.regexp.internal.RE;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: lizhi
 * @Description:
 * @Date: create in 2020/11/9 16:04
 */
public class RoleOrganUtils {

    public static final String ROLE_ID = "system";

    public static final String ORGAN_ID = "000000";
    /**
     * 获取权限串
     * @param roleIds
     * @return
     */
    public static List<String> listRoleIds(String roleIds){
        List<String> listRoleId = new ArrayList<>();
        if (roleIds.contains(ROLE_ID)){
            return null;
        }
        String[] strings = roleIds.split(",");
        for (String roleId : strings){
            listRoleId.add(roleId);
        }
        return listRoleId;
    }

    /**
     * 获取机构串
     * @param organIds
     * @return
     */
    public static List<String> listOrganIds(String organIds){
        List<String> listOrganIds = new ArrayList<>();
        if (organIds.contains(ORGAN_ID)){
            return null;
        }
        String[] strings = organIds.split(",");
        for (String organId : strings){
            listOrganIds.add(organId);
        }
        return listOrganIds;
    }
}
